﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

namespace WebServer.Remote
{
    /// <summary>
    /// WebService1 的摘要说明  webServer 没用重载
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {
        [SoapHeader("CustomSoapHeader")]
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
        [WebMethod]
        public string GetName0(int i)
        {
            return $"{i}+++IEnumable";
        }
        [WebMethod]
        public string GetName(int i,int y)
        {
            return $"{i+y}+++IEnumable";
        }
        [WebMethod]
        public int plus(int i, int y)
        {
            return i + y;
        }
        [WebMethod]
        public string GetName01(int id,string name)
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(new
            {
                id = id,
                name = name,
                remark = $"thsiis{id}{name}"
            }); ;
        }
        [WebMethod]
        public userinfo GetNameUser(int id, string name)
        {
            return new userinfo()
            {
                Id=id,
                Name=name,
                Age=17
            };
        }
        [WebMethod]
        public List<userinfo> GetNameUserlist(int id, string name)
        {
          return   new List<userinfo>()
            {
               new userinfo(){
                Id = id,
                Name = name,
                Age = 17
               },
               new userinfo(){
                Id = id,
                Name = name,
                Age = 17
               }
            };
        }
    }
}
